/*
 * IOController.h
 *
 *  Created on: 09/02/2014
 *      Author: Luiggi
 */

#ifndef IOCONTROLLER_H_
#define IOCONTROLLER_H_

#include<SDL2/SDL.h>

class ScreenManager;
class Triangulation;
class Navimesh;
class Constraint;

class IOController
{
public: /// STATICS ans CONSTS
	int TRIANGULATION_W = 128;
	int TRIANGULATION_H = 128;

public: /// METHODS
	IOController();
	virtual ~IOController();

	void Initialize();
	void Run();

private: /// ATTRIBUTES
	ScreenManager * screenManager;
	Triangulation* triangulation;
	Navimesh* mesh;

	bool renderTriangles;
	bool renderConstraints;
	bool onlyConstrained;
	bool isRunning;
	bool isMovingCamera;

	/// Constraint insertion controls
	bool isAutoInsertConstraint;
	int constraintStep;
	int constraintEnd;
	Constraint* constraintList;

private: /// METHODS
	/// Input handling
	void HandleEvents();
	void HandleKeyDown(SDL_Event& keyDownEvent);

	/// Triangulation and NaviMesh Stuff
	void InsertConstraint(Constraint constraint);
	void insertRandomConstraint(float w, float h);
	void TriangulationSetUp(float w, float h);
	void generateNaviMesh();

};

#endif /// IOCONTROLLER_H_
